home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / Snippets / Files / PBDTGetAppl / Source / ErrMsg.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-10-07  |  1.1 KB  |  67 lines  |  [TEXT/KAHL]

  1. /*
  2.     9-30-92  • Brigham Stevens
  3.     --------------------------
  4.  
  5.     This contains code for handling an error dialog box.
  6.     
  7.     If you want to display an error code and string, call ErrMsgCode,
  8.     otherwise, for string only, just call ErrMsg.
  9. */
  10.  
  11. #define KEEP_GOING 1
  12. #define DEBUGGER 2
  13. #define EXITTOSHELL 3
  14.  
  15.  
  16. void Msg(Str255 msg)
  17. /*
  18.     Display an Alert with the string passed.
  19. */
  20. {
  21.     ParamText(msg,nil,nil,nil);
  22.     Alert(130, nil);
  23. }
  24.  
  25. void ErrMsgCode(Str255 msg, short code)
  26. /*
  27.     Display the error alert with
  28.     an error code.
  29.     
  30.     This handy alert will also display 
  31.     memerr and reserr for you.
  32. */
  33.     Str31    codeStr;
  34.     Str31    memErrStr;
  35.     Str31    resErrStr;
  36.     short    disposition;
  37.     
  38.     NumToString(code,codeStr);
  39.     NumToString(MemErr,memErrStr);
  40.     NumToString(ResErr,resErrStr);
  41.     
  42.     ParamText(msg, codeStr, memErrStr, resErrStr);
  43.  
  44.     disposition = Alert(128, nil);
  45.     
  46.     switch(disposition)
  47.     {
  48.         case    KEEP_GOING:        return;
  49.                                 break;
  50.         case    DEBUGGER:        DebugStr("\p Doing a Stack Crawl;sc6");
  51.                                 break;
  52.         case    EXITTOSHELL:    ExitToShell();
  53.                                 break;
  54.     }
  55. }
  56.  
  57.  
  58. void ErrMsg(Str255 msg)
  59. /*
  60.     No error code desired.
  61. */
  62. {
  63.     ErrMsgCode(msg, 0);
  64. }
  65.  
  66.